﻿<table class="display dataTable">
    <thead>
        <tr role="row">
            <th style="width: 100px;">Mã phòng</th>
            <th style="width: 200px;">Hạng phòng</th>
            <th style="width: 200px;">Loại phòng</th>
            <th style="width: 120px;">Tầng</th>
            <th style="width: 100px;">Dãy</th>
            <th>Quản lý</th>
        </tr>
    </thead>
    <tbody>
        @{foreach (var PKS in Model)
          {
            <tr class="odd">
                <td>
                    <div class="nonDisplay">
                        @{var page = Model.PageNumber;}
                        <input type="text" class="@{@PKS.maPhong}" value="@{@page}"/>
                    </div>@PKS.maPhong</td>
                <td>
                    <div class="nonDisplay maHang@{@PKS.maPhong}">
                        <select id="maHang@{@PKS.maPhong}" class="maHangPhong">
                            @foreach (var P_HP in ViewBag.HKS)
                            {
                                if (P_HP.maHangPhong == PKS.maHangPhong)
                                {
                                <option value="@P_HP.maHangPhong" selected="selected">@P_HP.tenHangPhong</option>
                                }
                                else
                                {
                                <option value="@P_HP.maHangPhong" >@P_HP.tenHangPhong</option>
                                }
                            }
                        </select>
                    </div>
                    <div class="maHangP@{@PKS.maPhong}">
                        @foreach (var P_HP in ViewBag.HKS)
                        {
                            if (P_HP.maHangPhong == PKS.maHangPhong)
                            {
                            @P_HP.tenHangPhong
                            }

                        }
                    </div>
                </td>
                <td>
                    <div class="nonDisplay maLoai@{@PKS.maPhong}">
                        <select id="maLoai@{@PKS.maPhong}" class="maLoaiPhong">
                            @foreach (var L_HP in ViewBag.LKS)
                            {
                                if (L_HP.maLoaiPhong == PKS.maLoaiPhong)
                                {
                                <option value="@L_HP.maLoaiPhong" selected="selected">@L_HP.tenLoaiPhong</option>
                                }
                                else
                                {
                                <option value="@L_HP.maLoaiPhong" >@L_HP.tenLoaiPhong</option>
                                }

                            }
                        </select>
                    </div>
                    <div class="maLoaiP@{@PKS.maPhong}">
                        @foreach (var L_HP in ViewBag.LKS)
                        {
                            if (L_HP.maLoaiPhong == PKS.maLoaiPhong)
                            {
                            @L_HP.tenLoaiPhong
                            }

                        }
                    </div>
                </td>
                <td>
                    <div class="nonDisplay maTang@{@PKS.maPhong}">
                        <select id="maTang@{@PKS.maPhong}" class="maTangPhong">
                            @foreach (var T_HP in ViewBag.TKS)
                            {
                                if (T_HP.maTang == PKS.maTang)
                                {
                                <option value="@T_HP.maTang" selected="selected">@T_HP.tenTang</option>
                                }
                                else
                                {
                                <option value="@T_HP.maTang" >@T_HP.tenTang</option>
                                }

                            }
                        </select>
                    </div>
                    <div class="maTangP@{@PKS.maPhong}">
                        @foreach (var T_HP in ViewBag.TKS)
                        {
                            if (T_HP.maTang == PKS.maTang)
                            {
                            @T_HP.tenTang
                            }

                        }
                    </div>
                </td>
                <td>
                    <div class="nonDisplay maDay@{@PKS.maPhong}">
                        <select id="maDay@{@PKS.maPhong}" class="maDayPhong">
                            @foreach (var D_HP in ViewBag.DKS)
                            {
                                if (D_HP.maDay == PKS.maDay)
                                {
                                <option value="@D_HP.maDay" selected="selected">@D_HP.tenDay</option>
                                }
                                else
                                {
                                <option value="@D_HP.maDay" >@D_HP.tenDay</option>
                                }

                            }
                        </select>
                    </div>
                    <div class="maDayP@{@PKS.maPhong}">
                        @foreach (var D_HP in ViewBag.DKS)
                        {
                            if (D_HP.maDay == PKS.maDay)
                            {
                            @D_HP.tenDay
                            }

                        }
                    </div>
                </td>
                <td>
                    <div>
                        <img class="editP" id="@PKS.maPhong" src="../Images/icon_edit.png">
                        <img class="deleteP" id="@PKS.maPhong" src="../Images/icon_delete.png">
                        <img class="save_editP nonDisplay" id="@PKS.maPhong" src="../Images/checkmark2.png">
                        <img class="cancel_editP nonDisplay" id="@PKS.maPhong" src="../Images/cross.png">
                    </div>
                </td>
            </tr>
          }
        }
    </tbody>
</table>
<div class="pagging">
    Trang @(Model.PageCount < Model.PageNumber ? 0 : Model.PageNumber)
    / @Model.PageCount

    @if (Model.HasPreviousPage)
    {
        <a class="uibutton paggingR" id="1" title="Về trang đầu"><<</a>
        @Html.Raw(" ");
                      var page = Model.PageNumber - 1;
        <a class="uibutton paggingR" id="@{@page}" title="Về trang trước">< Lùi</a>
    }
    else
    {
        @:<<
        @Html.Raw(" ");
        @:< Lùi
    }

    @if (Model.HasNextPage)
    {
        var page = Model.PageNumber + 1;
        <a class="uibutton paggingR" id="@{@page}" title="Về trang sau">Tiến ></a>
        @Html.Raw(" ");
                      page = Model.PageCount;
        <a class="uibutton paggingR" id="@{@page}" title="Về trang cuối">>></a>
    }
    else
    {
        @: Tiến >
        @Html.Raw(" ")
        @:>>
    }
</div>
